<template>
  <view>
    <view class="user-section">
      <User :avatar="user.avatar" :name="user.nickname"></User>
    </view>
    <u-sticky>
    	<Tabs v-model="tabIndex" :list="tabs" @change="tabChange" bg></Tabs>
    </u-sticky>
    <view class="drawer safe-box">
      <Goods v-if="tabIndex === tabs[0].id" :list="goodsList"></Goods>
      <News v-else :list="newsList"></News>
    </view>
  </view>
</template>

<script>
  import Goods from './components/goods.vue'
  import News from './components/news.vue'
  export default {
    components: {
      Goods,
      News
    },
    data() {
      return {
        user: {},
        goodsList: [],
        newsList: [],
        tabIndex: 0,
        tabs: [{id: 0, name: '物品'}, { id: 1, name: '动态' }]
      }
    },
    methods: {
      getList() {
        
      },
      tabChange() {
        
      }
    },
    onLoad(e) {
      this.$http.get('/fan/business-home', {
        id: e.id
      }).then(res => {
        this.user = res.data.user
        this.goodsList = res.data.goodsList
        this.newsList = res.data.newsList
      })
    }
  }
</script>

<style>

</style>
